﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.LookAndFeel;
using CommonControl;
using DevExpress.XtraEditors;

namespace YJY_DMZS
{
    internal static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.UserSkins.BonusSkins.Register();
            UserLookAndFeel.Default.SetSkinStyle("Office 2007 Blue");
            //UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");

            Parameter.RunType = RunType.DevelopmentDebug;

            //未捕捉异常处理
            Application.ThreadException +=
            new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException +=
            new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            Application.Run(new FrmMainRibbon());
        }


        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            XtraMessageBox.Show("未处理事件异常：" + (e.ExceptionObject as Exception).Message);
            Utils.WriteTxtLog(e.ExceptionObject as Exception);
        }

        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            XtraMessageBox.Show("未处理线程异常：" + e.Exception.Message);
            Utils.WriteTxtLog(e.Exception);
        }
    }
}
